from __future__ import annotations

from dataclasses import dataclass
from typing import Protocol, Optional, List, Mapping


@dataclass
class EmailMessage:
    subject: str
    body_text: Optional[str] = None
    body_html: Optional[str] = None
    to: List[str] = None
    cc: Optional[List[str]] = None
    bcc: Optional[List[str]] = None
    attachments: Optional[List[Mapping[str, bytes]]] = None  # [{filename, content_bytes, mime_type}]


class EmailProvider(Protocol):
    def send(self, msg: EmailMessage) -> str:
        """发送一封邮件，返回 provider 回执ID（或Message-Id）。"""
        ...


